package test;

import java.util.Arrays;

/**
 * @author oldliu
 * @since 1.0
 */
public class Lottery {
    public static void main(String[] args) {
        int[] red = new int[6];
        for (int i = 0; i < red.length; ) {
            red[i] = (int) (Math.random() * 33) + 1;
            //从0到i-1这个位置上的数不能和当前的值有重复
            boolean repeat = false;//假定没有
            for (int j = 0; j < i; j++) {
                if (red[i] == red[j]) {
                    repeat = true;
                    break;
                }
            }
            if (!repeat) {
                i++;
            }
        }
        Arrays.sort(red);
        int blue = (int) (Math.random() * 16 + 1);
        for (int i = 0; i < red.length; i++) {
            System.out.print(red[i] + " ");
        }
        System.out.println(blue);
    }
}
